//
//  ALSTextField.m
//  ALS3.0
//
//  Created by guomianxiang on 17/3/15.
//  Copyright © 2017年 guomianxiang. All rights reserved.
//

#import "ALSTextField.h"
#import "LGtools.h"
@interface ALSTextField ()<UITextFieldDelegate,LGInputAccessoryViewActionDelegate>

@end

@implementation ALSTextField

- (void)awakeFromNib {
    [super awakeFromNib];

    self.inputAccessoryView = [[LGInputAccessoryView alloc]init];
    
    self.delegate = self;
    [self textFieldShouldEndEditing:self];
    self.textColor = [UIColor whiteColor];
    self.backgroundColor = [UIColor clearColor];
    self.tintColor = kColorFromRGB(0x3fedeb);
}

#pragma mark - UITextFieldDelegate

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    textField.layer.cornerRadius=8.0f;
    textField.layer.masksToBounds=YES;
    textField.layer.borderColor= kColorFromRGB(0x3fedeb).CGColor;
    textField.layer.borderWidth= 1.0f;
    return YES;
}

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
    textField.layer.cornerRadius=8.0f;
    textField.layer.masksToBounds=YES;
    textField.layer.borderColor= kColorFromRGB(0xa0a0a0).CGColor;
    textField.layer.borderWidth= 1.0f;
    return YES;
}

#pragma mark - set

- (void)setInputAVActionDelegate:(id<LGInputAccessoryViewActionDelegate>)inputAVActionDelegate {
    _inputAVActionDelegate = inputAVActionDelegate;
    
    LGInputAccessoryView *input = (LGInputAccessoryView *)self.inputAccessoryView;
    input.actionDelegate = inputAVActionDelegate;
}

@end
